<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<html>
<head>
<title>留言列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<table width="96%">
  <tr bgcolor="#6699CC">
    <td colspan="4"><table width="100%">
      <tr bgcolor="#6699CC">
        <td height="25"></td>
        <td><font color="WHITE" style="font-size:16px; font-weight:bold;">留言列表（共${page_content.pages }页${page_content.counts }个留言)</font></td>
      </tr>
    </table></td>
  </tr>
  <tr bgcolor="#6699CC">
    <td height="25">编号</td>
    <td>留言内容</td>
    <td>留言时间</td>
    <td>操作</td>
  </tr>
  <c:forEach var="message_list" items="${message_list}">
    <tr>
      <td height="25"><input type="checkbox" name="check_box" id="check_box" value="${message_list.id}" />
        &nbsp;${message_list.id }</td>
      <td><a href="${webpath}/admin/message/Message.do?action=displayMessageInfo&id=${message_list.id}" target="_blank">${fn:substring(message_list.message,0,26) }</a></td>
      <td>${fn:substring(message_list.create_time,0,10) }</td>
      <td><a href="${webpath}/admin/message/Message.do?action=delMessage&id=${message_list.id }&page=${page_content.pagecur}">删除</a></td>
    </tr>
  </c:forEach>
  <tr>
    <td colspan="4" align="right"><form method="post" action="" id="all" name="all">
      <input type="radio" name="all_option" id="all_option" value="all_delete">
      删除选中
                <input type="hidden" name="ids" id="ids" value="" />
                <input type="hidden" name="page" id="page" value="${page_content.pagecur}" />
      &nbsp;
      <input type="button" name="button" id="button" value="提交" onClick="all_oper()" />
    </form></td>
  </tr>
  <tr>
    <td colspan="4"><table width="100%">
      <tr>
        <td align="center" height="30"><form id="rollpage" method="post" action="${webpath}/admin/message/Message.do?action=findMessage">
          <input type="hidden" name="page"/>
        </form>
              <p align="center">
                <c:import url="/common/rollpage.jsp"></c:import>
            </p></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
<script>
	function all_oper()
	{
		var check_box=document.getElementsByName("check_box");
		var str="",temp_i=0;
		for(var i=0;i<check_box.length;i++)
		{
			if(check_box[i].checked)
			{
				if(temp_i==0)
				{
					str+=check_box[i].value;
					temp_i++;
				}
				else
				{
					str+=","+check_box[i].value;
				}
			}
		}
		document.getElementById("ids").value=str;
		if(document.getElementById("all").all_option.checked && str!="")
		{
			document.getElementById("all").action="${webpath}/admin/message/Message.do?action=deleteBatchMessage";
			document.getElementById("all").submit();
		}
	}
</script>
</html>
